import React ,{useContext} from 'react'

import {fruitContext,animalContext} from "./index"
    const Child2 = ()=>{
        let animal = useContext(animalContext)
        let fruit = useContext(fruitContext)
        return(
            <fieldset>
                <legend>Child2</legend>
                {/* 非常繁琐 */}
                {/* <fruitContext.Consumer>
                    {
                        (paramA)=><animalContext.Consumer>
                            {
                                paramB=>{
                                    console.log(paramB);
                                    console.log(paramA);
                                    return(
                                        <h4>animalContext:{paramB}----fruitContext:{paramA}</h4>
                                    )
                                }
                            }
                        </animalContext.Consumer>
                    }
                </fruitContext.Consumer> */}
                <h4>animalContext:{animal}----fruitContext:{fruit}</h4>
            </fieldset>
        )
    }

    export default Child2